﻿<Window x:Class="RelativeSource"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="RelativeSource" Height="203.785" Width="300">
    <Grid Background="LightGoldenrodYellow">
      <StackPanel Background="LightGreen" Margin="22">
            
        <TextBlock 
            Background="{Binding Path=Background, 
                            RelativeSource={RelativeSource Mode=FindAncestor, 
                                 AncestorType={x:Type Grid}}}" 
            Margin="11" Text="RelativeSource binding back to grid" />
        
        <TextBlock ToolTip="{Binding Path=Text, 
            RelativeSource={RelativeSource Mode=Self}}" 
                   Margin="11" Text="This will appear in the ToolTip" />
            
      </StackPanel>
    </Grid>
</Window>
